//
// Created by hp on 2019/10/17.
//

#include "head/attack_details.h"

int
get_details(struct http_request *req)
{
    int	uid = 10;
    if (http_argument_get_uint16(req, "uid", &uid)){
        kore_log(LOG_NOTICE, "uid: %d", uid);
    }else{
        kore_log(LOG_NOTICE, "No uid set");
    }

    int	detail = 10;
    if (http_argument_get_uint16(req, "detail", &detail)){
        kore_log(LOG_NOTICE, "detail: %d", detail);
    }else{
        kore_log(LOG_NOTICE, "No detail set");
    }

    int	len = 10;
    if (http_argument_get_uint16(req, "len", &len)){
        kore_log(LOG_NOTICE, "len: %d", len);
    }else{
        kore_log(LOG_NOTICE, "No len set");
    }

    struct kore_buf	*buf;

    buf = kore_buf_alloc(32);
    kore_buf_appendf(buf, "[");
    kore_buf_appendf(buf, "%s", "gg");
    kore_buf_appendf(buf, "]");
    http_response_header(req, "content-type", "text/json");
    http_response(req, 200, buf->data, buf->offset);
    return (KORE_RESULT_OK);
}